// https://leetcode.cn/problems/first-unique-character-in-a-string/
// Created by ade on 2022/8/4.
//

class Solution {
public:
    int firstUniqChar(string s) {
        int r[26] = {0};
        for (auto i : s) {
            r[i - 'a']++;
        }
        for (int i = 0; i < s.size(); i++) {
            if (r[s[i] - 'a'] == 1) return i;
        }
        return -1;
    }
};